/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mscs.cashier.view;

import java.util.List;
import javax.swing.UIManager;
import mscs.data.IFileDataStore;
import mscs.data.IReturnRecordProxy;
import mscs.data.ISaleRecordProxy;
import mscs.data.pojo.ReturnRecord;
import mscs.data.pojo.SaleRecord;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 *
 * @author Cake
 */
public class CashierApp extends SingleFrameApplication{
       /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        try {
         UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception e) {
         e.printStackTrace();
        }
        show(new CashierFrame());
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
       // ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(CashierApp.class).getContext().getResourceMap(CashierFrame.class);  
       /*
        ResourceMap resourceMap = getContext().getResourceMap(CashierFrame.class);  
        Image image = resourceMap.getImageIcon("icon").getImage();  
        root.setIconImage(image); 
         * */
         
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of MscsApp
     */
    public static CashierApp getApplication() {
        return Application.getInstance(CashierApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(CashierApp.class, args);
        IFileDataStore allSale=new ISaleRecordProxy();
        List<SaleRecord> allSaleRecordList= (List<SaleRecord>)allSale.getObjects(); 
        IFileDataStore allReturn=new IReturnRecordProxy();
        List<ReturnRecord> allReturnRecordList= (List<ReturnRecord>)allReturn.getObjects(); 
        System.out.println(allReturnRecordList.get(1).getGoodsList().get(0).getDesc());
        System.out.println(allSaleRecordList.get(0).getId());
    }
}
